package spring_test;

import java.util.Set;
import java.util.Map.Entry;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTest {
	public static void main(String[] args)		{
		ApplicationContext context = new ClassPathXmlApplicationContext("spring_test/animal_conf.xml");
//		Bird bird = context.getBean(Bird.class);					//use class
		Bird bird = (Bird)context.getBean("bird8");				//use bean id
//		Bird bird = context.getBean("bird6", Bird.class);		//use class + bean id
		System.out.println(bird.getId()+" "+bird.getName()+" "+bird.getSwing().getCount());
		
//		ApplicationContext context = new ClassPathXmlApplicationContext("spring_test/collection_conf.xml");
//		CollectionTest collectionTest = context.getBean("collection01", CollectionTest.class);
//		Set<Entry<String, Float>>setEntry = collectionTest.getAccounts().entrySet();
//		for(Entry<String, Float> entry : setEntry)		{
//			System.out.println(entry.getKey()+" "+entry.getValue());
//			if(entry.getValue() == null)		{
//				System.out.println("!");
//			}
//		}
	}
}
